package services

import (
	"aiserver/pkg/models"
	"aiserver/pkg/store"
)

type UserSrv interface {
	GetAndCreateUserByName(username string) (*models.User, error)
	GetUserByName(username string) (*models.User, error)
}

type userService struct {
	store store.Factory
}

func newUsers(srv *service) *userService {
	return &userService{store: srv.store}
}

func (us *userService) GetAndCreateUserByName(username string) (*models.User, error) {
	return us.store.Users().CreateGet(username, "", false)
}
func (us *userService) GetUserByName(username string) (*models.User, error) {
	return us.store.Users().GetUser(username)
}
